# time 模块的使用
import time

now = time.localtime()  # 获取当前时间
# print(now)              # time.struct_time(tm_year=2021, tm_mon=7, tm_mday=15, tm_hour=15, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=196, tm_isdst=0)

now_str = time.strftime("%Y年%m月%d日 %H:%M", now)
print(now_str)          # 2021-07-15 15:00:00，变为指定格式的字符串